<template>
  <div>
    <div class="cover">
      <div class="icon">C</div>
      <div v-show="ban">
        <div class="title2">14ch.cn</div>
        <div class="container" id="BContainer"></div>
      </div>
    </div>
    <div class="aside box" id="Aside2">
      <div class="title">
        <div class="titlebg"></div>
        <h3 class="titleword">三月十四 陈宗豪的小站</h3>
        <div class="iconfont icon-caidan pushdown" @click="func" v-show="status===0"></div>
        <div class="iconfont icon-arrowup pushdown" @click="func" v-show="status!==0"></div>
        <transition name="fade">
          <div class="under-title" v-show="underdis"   >
            <div class="tablecover">
              <table border="0" class="classtable">
                <tr>
                  <th></th>
                  <th>月</th>
                  <th>火</th>
                  <th>水</th>
                  <th>木</th>
                  <th>金</th>
                  <th>土</th>
                  <th>日</th>
                </tr>
                <tr>
                  <td>上</td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td>海量数据开发<br>C505</td>
                  <td></td>
                </tr>
                <tr>
                  <td>午</td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td>海量数据开发<br>C505</td>
                  <td></td>
                </tr>
                <tr>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td>下</td>
                  <td>网络综合实验<br>C310</td>
                  <td>勤工俭学<br>C501</td>
                  <td>勤工俭学<br>C501</td>
                  <td>勤工俭学<br>C501</td>
                  <td>海量数据开发<br>C505</td>
                  <td>海量数据开发<br>C505</td>
                  <td></td>
                </tr>
                <tr>
                  <td>午</td>
                  <td>网络综合实验<br>C310</td>
                  <td></td>
                  <td>勤工俭学<br>C501</td>
                  <td></td>
                  <td>海量数据开发<br>C505</td>
                  <td>海量数据开发<br>C505</td>
                  <td></td>
                </tr>
              </table>
            </div>
            <div class="fungroup" >
              <div class="space"></div>
              <a href="https://gitee.com/chzh314">
                <div class="funcontainer">
                  <div class="box function">
                    <span class="alphabeta">C</span>
                    <span class="subtitle">代码仓库</span>
                  </div>
                </div>
              </a>
              <a href="http://14th.top">
                <div class="funcontainer">
                  <div class="box function">
                    <span class="alphabeta">T</span>
                    <span class="subtitle">试验站点</span>
                  </div>
                </div>
              </a>
              <a href="/game">
                <div class="funcontainer">
                  <div class="box function">
                    <span class="alphabeta">G</span>
                    <span class="subtitle">游戏</span>
                  </div>
                </div>
              </a>
              <div class="funcontainer" @click="info">
                <div class="box function">
                  <span class="alphabeta">P</span>
                  <span class="subtitle">个人简历</span>
                </div>
              </div>
            </div>
            <div class="info" >
              辽ICP备17018178号-1
            </div>
          </div>
        </transition>

      </div>

    </div>
    <transition name="fade">
      <div class="turnback" @click="func" v-show="status!==0"></div>
    </transition>
  </div>

</template>

<script>
  import bus from '../assets/js/Eventbus';
    export default {
        name: 'Banner',
        data() {
            return {
              container:null,
              ban:true,
              status:0,
              aside:null,
              underdis:false,
            }
        },
        methods: {
          func(){
            switch (this.status){
              case 0:
                window.setTimeout(()=>{
                  this.status=2;
                  this.underdis=true;
                },100);
                this.status=1;
                break;
              case 1:
              case 2:
                this.underdis=false;
                this.status=0;
                break;
              default:
                break;
            }
            this.init();
          },
          info(){
            bus.$emit('gotoinfo');
            this.status=0;
            this.underdis=false;
            this.init();
          },
          init(){
            if(this.pagewidth>768){
              this.aside.style.height='300px';
              this.aside.style.backgroundColor='#fff';
              this.aside.style.borderRadius='5px';
              this.status=0;
              this.underdis=true;
            }else{
              switch (this.status){
                case 0:
                  this.aside.style.height='40px';
                  this.aside.style.borderRadius='0';
                  this.aside.style.background='rgba(114, 209, 251, 0.8)';
                  this.underdis=false;
                  break;
                case 1:
                case 2:
                  this.aside.style.height='70%';
                  this.aside.style.borderRadius='0 0 5px 5px';
                  this.aside.style.background='rgba(114, 209, 251, 1)';

                  break;
                default:
                  break;
              }
            }
          }
        },
        created() {
          window.onload=()=>{
            this.$store.commit('setWidth',document.documentElement.clientWidth);
            this.aside=document.getElementById('Aside2');
            this.init();
            window.onresize=()=>{
              this.$store.commit('setWidth',document.documentElement.clientWidth);
              bus.$emit('changesize');
//              console.log(this.pagewidth);
              this.init();
            }
          }
        },
        mounted() {
          this.container=document.getElementById('BContainer');
          bus.$on('scoll',(scr)=>{
            if(scr>50){
//              this.container.style.width='50%';
//              this.container.style.height='0';
//              this.container.style.opacity='0.1';
//              this.ban=false;
            }else if(scr>0){
              this.container.style.width='90%';
              this.container.style.opacity='0.8';
              this.container.style.height='40px';
              this.container.style.borderRadius='0 0 5px 5px';
            }else{
              this.container.style.width='100%';
              this.container.style.height='40px';
              this.container.style.opacity='1';
              this.container.style.borderRadius='0px';
              this.ban=true;
            }
          })
          bus.$on('changesize',()=>{
            this.container.style.width='100%';
            this.container.style.height='40px';
            this.container.style.borderRadius='0px';
            this.container.style.opacity='1';
            this.ban=true;
          })
        },
      computed:{
        pagewidth(){
          return this.$store.state.pagewidth;
        }
      }
    }
</script>

<style scoped>
.container{
  position: fixed;
  z-index: 140;
  left: 50%;
  top:0;
  width: 100%;

  height: 40px;
  transform: translate(-50%,0);
  background: #ffffff;
  border-bottom:1px solid #76b0fb;
  box-shadow: 0 0 5px #76b0fb;
  transition: all 0.5s ease;
}
.title2{
  position: fixed;
  left:calc(10% + 32px);
  font-weight: 600;
  z-index: 142;
  line-height: 55px;
}
.icon{
  /*font-family: 幼圆;*/
  position: fixed;
  left:10%;
  z-index: 141;
  top:5px;
  width:25px;
  height:30px;
  border-radius: 5px;
  background: #76b0fb;
  line-height: 40px;
  padding-left: 5px;
  font-size: 32px;
  overflow: hidden;
  color: white;
  font-weight:800;
}
.under-title{
  position:absolute;
  width:100%;
  /*height:75%;*/
  z-index: 199;
  /*left:2px;*/
  /*top:25%;*/

}
.box{
  /*box-shadow:0 0 2px #9d9d9d;*/
  transition:all 0.5s ease;
}
/*.box:hover{*/
/*box-shadow:0 0 6px #9d9d9d;*/
/*}*/
.aside{
  background-color: #72d1fb;
  overflow: hidden;
  color: #fff;
}
.pushdown{
  display: none;
}
.turnback{
  position: fixed;
  left:0;
  top:0;
  background: rgba(0, 0, 0, 0.2);
  width:100%;
  height:100%;
  z-index: 300;
}
@media (min-width: 768px) {
  .aside{
    display:none;
  }

}
@media (max-width: 768px){
  .cover{
    display: none;
  }
  .aside {
    position:fixed;
    height:40px;
    width:100%;
    overflow: hidden;
    line-height: 5px;
    text-align: left;
    box-shadow: none;
    z-index: 500;
    background: rgba(114, 209, 251, 0.80);
  }
  .pushdown{
    display:block;
    position: fixed;
    right:10px;
    top:18px;
    font-size:25px;
  }
  .title{

  }
  .titleword{
    margin-left:10px;
  }
  .under-title{
    /*display:none;*/
    position:fixed;
    top:40px;
    z-index: 501;
    height:calc(70% - 40px);
    transition:all 0.5s ease;
  }
  .function{
    height:50px;
    background: #badbf7;
    overflow: hidden;
    box-shadow:0 0 0 0 #abbff6,0 2px 2px #fff;
  }
  .funcontainer{
    /*display:inline-block;*/
    position:relative;
    width:70px;
    height:40px;
    margin:5px;
    margin-bottom:20px;
    float:left;
    /*overflow: hidden;*/
  }
  .fungroup{
    display:flex;
    flex-direction:row;
    justify-content: center;
    align-items:center;
    width:100%;
    z-index: 510;
    position:fixed;
    left:0;
    top:calc(70% - 100px);
  }
  .space{
    height:50px;
    width:0;
  }
  .tablecover{
    width:80%;
    line-height:normal;

    /*left:2.5%;*/
    position: absolute;
    left: 50%;  top:50px;
    transform: translate(-50%, 0);
    font-size:12px;
  }
  tr,th{
    height:30px;
    width:80px;
  }
  td{
    font-size:9px;
  }

  .info{
    position:fixed;
    left:0;
    width:100%;
    text-align:center;
    color:#fff;
    line-height: 20px;
    top:calc(70% - 30px);
    font-size:12px;
  }
  .alphabeta{
    font-family:Arial, "Helvetica Neue", Helvetica, sans-serif;
    margin-left:20px;
    line-height:60px;
    margin-top: 0;
    font-size: 70px;
    color: #fff;
  }
  .subtitle{
    display:block;
    line-height:15px;
    position:absolute;
    color: #fff;
    width:100%;
    left:0;
    height:15px;
    top:35px;
    font-size:10px;
    background: rgba(164, 181, 246, 0.5);
    text-align: center;
  }
}
.fade-enter-active, .fade-leave-active {
  transition: all .5s;
}

.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */
{
  opacity: 0;
}
  @media (max-width: 768px) {

  }
</style>
